package com.game.chessgame;

public class Knight extends Piece {
    public Knight(Player player) {
        super(player);
    }

    @Override
    public char getSymbol() {
        return (player == Player.WHITE) ? 'N' : 'n';
    }

    @Override
    public boolean canMove(int fromX, int fromY, int toX, int toY, Piece[][] board) {
        int dx = Math.abs(toX - fromX);
        int dy = Math.abs(toY - fromY);
        return (dx == 1 && dy == 2) || (dx == 2 && dy == 1);
    }
}